import cv2
import time 
print(cv2.__version__)
videoCapture = cv2.VideoCapture('falldata1-detected.avi')
 
fps = 10 #保存视频的帧率
frame_width = int(videoCapture.get(3))
frame_height = int(videoCapture.get(4))
size = (frame_width, frame_height) #保存视频的大小
 
videoWriter =cv2.VideoWriter('video4.avi',cv2.VideoWriter_fourcc('M','J','P','G'),fps,size)
i = 0
 
while videoCapture.isOpened():
    success,frame = videoCapture.read()
    #if success:
    i += 1
    print('i = ',i)
    if(i>=1 and i <= 112):
        videoWriter.write(frame)
        if(i==112):
            break
    else:
        print('end')   
        break  
        